Multiset Permutations in Lexicographic Order
نویسنده
چکیده
In a previous work [12], we proposed a method for generating permutations in lexicographic order. In this study, we extend it to generate multiset permutations. A multiset is a collection of items that are not necessarily distinct. The guideline of the extension is to skip, as soon as possible, those partially-formed permutations that are less than or equal to the latest generated eligible permutation. Multiset permutation can be applied in combinations generation, since a combination of q items out of n items is a special case of multiset permutations that contain q 1s and (n-q) 0s. Keywords—multiset permutation, lexicographic order, ranking, unranking, ordinal representation
منابع مشابه
A SAT-based Implementation for RPO Termination
This paper introduces a propositional encoding of the recursive path order (RPO) on terms which is a combination of a multiset path order and a lexicographic path order which considers permutations of the arguments in the lexicographic comparison. The proposed encoding allows us to use SAT solvers in order to determine whether a given term rewrite system is RPO terminating. An implementation is...
متن کاملA New Method for Generating Permutations in Lexicographic Order
First, an ordinal representation scheme for permutations is defined. Next, an “unranking” algorithm that can generate a permutation of n items according to its ordinal representation is designed. By using this algorithm, all permutations can be systematically generated in lexicographic order. Finally, a “ranking” algorithm that can convert a permutation to its ordinal representation is designed...
متن کاملMulti-level Loop-less Algorithm for Multi-set Permutations
We present an algorithm that generates multiset permutations in O(1) time for each permutation, that is, by a loop-less algorithm with O(n) extra memory requirement. There already exist several such algorithms that generate multiset permutations in various orders. For multiset permutations, we combine two loop-less algorithms that are designed in the same principle of tree traversal. Our order ...
متن کاملLoopless generation of multiset permutations using a constant number of variables by prefix shifts
This paper answers the following mathematical question: Can multiset permutations be ordered so that each permutation is a prefix shift of the previous permutation? Previously, the answer was known for the permutations of any set, and the permutations of any multiset whose corresponding set contains only two elements. This paper also answers the following algorithmic question: Can multiset perm...
متن کاملEfficient Algorithms to Rank and Unrank Permutations in Lexicographic Order
We present uniform and non-uniform algorithms to rank and unrank permutations in lexicographic order. The uniform algorithms run in O(n log n) time and outperform Knuth’s ranking algorithm in all the experiments, and also the lineartime non-lexicographic algorithm of Myrvold-Ruskey for permutations up to size 128. The non-uniform algorithms generalize Korf-Schultze’s linear time algorithm yet r...
متن کامل